<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title> {% block title %}{% endblock %}</title>
    <link rel="stylesheet" href="/static/base.css">
    <link rel="stylesheet" href="/static/bootstrap-3.37/css/bootstrap.min.css">
    <script type="text/javascript" src="/static/jquery-1.12.4.min.js"></script>
    <script type="text/javascript" src="/static/bootstrap-3.37/js/bootstrap.min.js"></script>
    {% block header_extends %}
    {% endblock %}
</head>
<body>
    <div class="navbar navbar-default navbar-fixed-top" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="{% url 'home' %}">个人博客网站</a>
                <button class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
            </div>

            <div  id="bs-example-navbar-collapse-1" class="collapse navbar-collapse">
                <ul class="nav navbar-nav">
                    <li class="{% block nav_home_active %}{% endblock %}"><a href="{% url 'home' %}">首页</a></li>
                    <li class="{% block nav_blog_active %}{% endblock %}"><a href="{% url 'blog_list' %}">博客</a></li>
                </ul>

            <ul class="nav navbar-nav navbar-right">
                {% if not user.is_authenticated %}
                    <li><a href="{% url 'login' %}?from={{ request.get_full_path }}">登录</a></li>
                    <li><a href="{% url 'register' %}?from={{ request.get_full_path }}">注册</a></li>
                {% else %}
                    <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ user.get_nickname_or_username}}<span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="{% url 'user_info' %}">用户信息</a></li>
                        <li><a href="{% url 'admin:index' %}">后台管理(Admin)</a></li>
                        <li><a href="{% url 'logout' %}?from={{ request.get_full_path }}">退出</a></li>

                    </ul>
                </li>
                {% endif %}
            </ul>

            </div>
        </div>

    </div>

    {% block content %}{% endblock %}
    {% block script_extends %}{% endblock %}
</body>
</html>

